import { DialogTable } from 'custom/index'
import { getHistoryPage } from '../api'

const cooperateStatusOptions = [
  { value: 1, label: '正在合作' },
  { value: 0, label: '停止合作' }
]


const historyDialog = new DialogTable('DialogTable')

historyDialog
  .title('历史记录')
  .width('70%')
  .api((params, row) => {
    const p = {
      ...params, 
      condition: { shopId: row.shopId }
    }
    return getHistoryPage(p)
  })
  .useTable()
    .addIndexColumn()
    .useColumn('createTime').label('操作时间').minWidth(180).end()
    .useEnumColumn('cooperateStatus', cooperateStatusOptions).label('合作状态').end()
    .useColumn('operator').label('操作者').end()
    .useColumn('startDate').label('开始日期').minWidth(180).end()
    .useColumn('endDate').label('结束日期').minWidth(180).end()
    .useColumn('remark').label('备注').end()
    .upto('DialogTable')
  .usePagination()

export { historyDialog }
